{template header}
    <header>
        <a href="javascript:;" onClick="javascript :history.back(-1);" class="headerL iconfont">&#xe66a;</a>
        <h1>交易详情</h1>
    </header>
    <!-- E header -->

    <!-- S 交易状态 -->
    <dl class="my_deal_condition">
        <dt><img src="{THEME_PATH}images/deal1.png" alt="" width="102" class="ico"></dt>
        <dd class="tit">待付款</dd>
        <dd>倒计时&nbsp;11:26:17</dd>
    </dl>
    <!-- E 交易状态 -->

<?php if($tinfo['sell_id']==$this->userinfo['id']) {?>
    <h2 class="my_deal_h2">转账会员信息</h2>
    <ul class="flex my_deal_user">
        <li><img src="{$buyer[ico]}" alt="" width="50" class="user_photo"></li>
        <li>
            <dl>
                <dt class="user_name">{$buyer[username]}</dt>
                <dd>{$buyer[mobile_phone]}</dd>
            </dl>
        </li>
    </ul>
    <!-- S 交易信息 -->
    <h2 class="my_deal_h2">交易信息</h2>
    <ul class="my_deal_msg_items">
        <li class="flex flex-pack-justify">
            <div>编号</div>
            <div>{$tinfo[order_sn]}</div>
        </li>
        <li class="flex flex-pack-justify">
            <div>数量(DBT)</div>
            <div>{$tinfo[num]}</div>
        </li>
        <li class="flex flex-pack-justify">
            <div>单价(USD)</div>
            <div>{$tinfo[price]}</div>
        </li>
        <li class="flex flex-pack-justify">
            <div>总价(USD)</div>
            <div>{$tinfo[amount]}</div>
        </li>
        <li class="flex flex-pack-justify">
            <div>时间</div>
            <div>2018-8-1 14:00:13</div>
        </li>
    </ul>
    <!-- E 交易信息 -->
        <h2 class="my_deal_h2">转账截图</h2>
        <div class="my_deal_screenshot" >
            <?php if($tinfo['pic']!="") {?>
            <img src="<?php echo $tinfo['pic']?>" alt="" class="img-responsive">
            <?php }else{?>
                <p style="text-align: center; color: #ccc; padding-bottom: 30px;">等待买家上传</p>
            <?php }?>
        </div>

<?php }?>

<?php if($tinfo['user_id']==$this->userinfo['id']) {?>
    <!-- S 会员信息 -->
    <h2 class="my_deal_h2">转账会员信息</h2>
    <ul class="flex my_deal_user">
        <li><img src="{$seller[ico]}" alt="" width="50" class="user_photo"></li>
        <li>
            <dl>
                <dt class="user_name">{$seller[username]}</dt>
                <dd>{$seller[mobile_phone]}</dd>
            </dl>
        </li>
    </ul>
    <ul class="my_deal_msg_items">
        <li class="flex flex-pack-justify">
            <div>真实姓名</div>
            <div>{$seller[true_name]}</div>
        </li>
        <li class="flex flex-pack-justify">
            <div>支付宝账号</div>
            <div>{$seller[alipay]} <i class="iconfont font24 verticalM">&#xe60c;</i></div>
        </li>
        <li class="flex flex-pack-justify">
            <div>微信账号</div>
            <div>{$seller[weixin]} <i class="iconfont font24 verticalM">&#xe60c;</i></div>
        </li>
        <li class="flex flex-pack-justify">
            <div>银行账号</div>
            <div>{$seller[banknum]}({$seller[bankaddress]})</div>
        </li>
    </ul>

    <!-- E 会员信息 -->
    <!-- S 交易信息 -->
    <h2 class="my_deal_h2">交易信息</h2>
    <ul class="my_deal_msg_items">
        <li class="flex flex-pack-justify">
            <div>编号</div>
            <div>{$tinfo[order_sn]}</div>
        </li>
        <li class="flex flex-pack-justify">
            <div>数量(DBT)</div>
            <div>{$tinfo[num]}</div>
        </li>
        <li class="flex flex-pack-justify">
            <div>单价(USD)</div>
            <div>{$tinfo[price]}</div>
        </li>
        <li class="flex flex-pack-justify">
            <div>总价(USD)</div>
            <div>{$tinfo[amount]}</div>
        </li>
        <li class="flex flex-pack-justify">
            <div>时间</div>
            <div>2018-8-1 14:00:13</div>
        </li>
    </ul>
    <!-- E 交易信息 -->
    <!-- S 上传转账截图 -->
    <h2 class="my_deal_h2">上传转账截图</h2>
    <div class="my_deal_screenshot" id="<?php echo $tinfo['pic']==""?"img1_box":"";?>">
        <img src="<?php echo $tinfo['pic']==""?"/template/wap/statics/images/proof.png":$tinfo['pic'];?>" alt="" class="img-responsive">
        <input type="hidden" name="pic" id="pic"  value="<?php echo $tinfo['pic'];?>" >
    </div>
    <!-- E 上传转账截图 -->
    <div class="my_deal_btnBox submit_box"><a href="javascript:void(0)" class="complain_btn" onclick="submitForm()">提交</a></div>

<?php }?>   




</body>


<link href="/statics/js/webuploader/webuploader.css" rel="stylesheet" />
<script src="/statics/js/webuploader/webuploader.js" type="text/javascript"></script>
<script type="text/javascript">


    var img1 = new WebUploader.create({
        auto:true,
        fileVal:'upfile',
        // swf文件路径
        swf: '/statics/js/webuploader/webuploader.swf',
        // 文件接收服务端。
        server: "/index.php?m=attachment&c=upload&a=swfupload",
        // 选择文件的按钮。可选
        formData:{
            "module":"",
            "catid":"",
            "userid":"1",
            "dosubmit":"1",
            "thumb_width":"0",
            "thumb_height":"0",
            "watermark_enable":"1",
            "filetype_post":"jpg|jpeg|gif|bmp|png",
            "swf_auth_key":"57a39f6f7415ec2cdd2b8afd77b57c3f",
            "isadmin":"1"
        },
        // 内部根据当前运行是创建，可能是input元素，也可能是flash.
        pick: {
            id: '#img1_box',
            multiple:false
        },
        accept:{
            title: '图片文件',
            extensions: 'gif,jpg,jpeg,bmp,png',
            mimeTypes: 'image/*'
        },
        thumb:{
            width: '110',
            height: '110',
        },
        chunked: false,
        chunkSize:1000000,
        // 不压缩image, 默认如果是jpeg，文件上传前会压缩一把再上传！
        resize: false
    });
    img1.onUploadSuccess = function( file, response ) {
        var pickid = this.options.pick.id;
        var data = response._raw;
        var arr = data.split(',');
        if(response.url.length > 0) {
            $(pickid).find('img').attr('src', response.url);
            // $(pickid).find('input[type=hidden]').eq(0).attr('value', response.url);
            $("#pic").attr('value', response.url);
        }
        console.log(response);
    }
    img1.onUploadError = function(file, reason) {
        hd_alert('文件上传错误：' + reason);
    }


    var inx;
    function submitForm(){
        layer.open({type: 2});

        var pic = $("#pic").val();
        var id = <?php echo $tinfo['id']?>;
        
        $.ajax({
            type:'post',
            url:'/index.php?m=user&c=trade&a=picadd',
            data:{id:id,pic:pic},
            dataType:'json',
            success:function(ret){
              layer.closeAll();
              console.log(ret);
              // if(ret.status==1){
              //     tips(ret.info,'/index.php?m=user&c=trade&a=tradedetail&id=<?php echo $tinfo['id']?>');
              // }else{
              //     tips(ret.info);
              // }
            }
        })

    }







</script>


</html>